import React from 'react';
import SettingsOutlined from '@material-ui/icons/SettingsOutlined';
import { EType, WType, CellView } from './type/view';
import { NavView, get_mod, NavListSub, loc } from 'sui';
import { UserView } from './user/view';
import { AuthView } from './auth/view';
import { CodeView } from './code/view';
import { ShiftView } from './shift/view';
import { StationView } from './station/view';

const model = (cfg) => {
    const fix = [
        {uid: "manage.cell", view: CellView, value: loc("l_265")},
        {uid: "manage.dv1", value: "divider"},
        {uid: "manage.etype", view: EType, value: loc("l_245")},
        {uid: "manage.wtype", view: WType, value: loc("l_251")},
        {uid: "manage.dv2", value: "divider"},
        {uid: "manage.user", view: UserView, value: loc("l_260")},
        {uid: "manage.auth", view: AuthView, value: loc("l_258")},
        {uid: "manage.dv3", value: "divider"},
        {uid: "manage.code", view: CodeView, value: loc("l_236")},
        {uid: "manage.dv4", value: "divider"},
        {uid: "manage.station", view: StationView, value: loc("l_255")},
        {uid: "manage.dv5", value: "divider"},
        {uid: "manage.dv6", value: "divider"},
        {uid: "manage.shift", view: ShiftView, value: loc("l_248")},
    ];

    return get_mod(cfg, fix, "manage");
};

const Manage = ({ mod, setEvent, sideopen, cfg }) => <NavView cfg={cfg} model={model(cfg)} mod={mod} setEvent={setEvent} sideopen={sideopen} name="manage"/>;

const NavManage = (props) => <NavListSub icon={<SettingsOutlined/>} sub={model(props.cfg)} {...props} scut={15}/>;

export {NavManage, Manage};
